package com.cx.service.admin.basic.impl;

import com.cx.dao.impl.ChainJKTDaoSupport;
import com.cx.service.admin.basic.ChainBasicPrivilegeManager;
import com.cx.service.admin.basic.ChainBasicRoleManager;
import org.cx.entity.Page;
import org.cx.entity.PageData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("chainBasicRoleService")
public class ChainBasicRoleService implements ChainBasicRoleManager {

    @Resource(name = "chainJKTDaoSupport")
    private ChainJKTDaoSupport chainJKTDao;


    @Override
    public List<PageData> findRoleDetailPage(Page pg) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("RoleMapper.findRoleDetailPage", pg);
        return list;
    }

    @Override
    public List<PageData> findRoleByPageDate(PageData pd) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("RoleMapper.findRoleByPageDate", pd);
        return list;
    }

    @Override
    public List<PageData> findRoleForChoseRole(PageData pd) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("RoleMapper.findRoleForChoseRole", pd);
        return list;
    }

    @Override
    public List<PageData> findRoleForChoseRoleNotClerk(PageData pd) {
        List<PageData> list = (List<PageData>) chainJKTDao.findForList("RoleMapper.findRoleForChoseRoleNotClerk", pd);
        return list;
    }


    @Override
    public PageData selectRoleByID(PageData pd) {
        pd = (PageData) chainJKTDao.findForObject("RoleMapper.selectRoleByID", pd);
        return pd;
    }

    @Override
    public Integer insertRole(PageData pd) {
        Integer result  =(Integer) chainJKTDao.save("RoleMapper.insertRole",pd);
        return result;
    }

    @Override
    public Integer updateRole(PageData pd) {
        Integer result =(Integer) chainJKTDao.update("RoleMapper.updateRole",pd);
        return result;
    }
}
